import request from '@/utils/request'

export const getNewCartGoods = skuId => {
	return request(`/goods/stock/${skuId}`, 'get')
}

export const mergeLocalCart = cartList => {
	return request('/member/cart/merge', 'post', cartList)
}

// 获取登录后的购物车列表
export const findCartList = () => {
	return request('/member/cart', 'get')
}

export const insertCart = ({
	skuId,
	count
}) => {
	return request('/member/cart', 'post', {
		skuId,
		count
	})
}

export const deleteCart = ids => {
	return request('/member/cart', 'delete', {
		ids
	})
}

export const updateCart = ({
	skuId,
	selected,
	count
}) => {
	return request(`/member/cart/${skuId}`, 'put', {
		selected,
		count
	})
}

export const checkAllCart = ({
	selected,
	ids
}) => {
	return request('/member/cart/selected', 'put', {
		selected,
		ids
	})
}
